1
'* Copyright (c) Microsoft Corporation.
3 '* The VBWordDocument project provides the examples on how manipulate Word 2007 Content Controls
4 '* in a VSTO document-level project
6 '* This source is subject to the Microsoft Public License.
7 '* See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL.
8 '* All other rights reserved.
10 '* THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
11 '* EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
12 '* WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
13 '\******************************************************************************************/
15 #Region
"Importing directives"
17 Imports System
.Collections
.Generic
21 Imports System
.Windows
.Forms
22 Imports System
.Xml
.Linq
23 Imports Microsoft
.VisualStudio
.Tools
.Applications
.Runtime
24 Imports Office
= Microsoft
.Office
.Core
25 Imports Word
= Microsoft
.Office
.Interop
.Word
26 Imports System
.Diagnostics
30 Public Class ThisDocument
32 Private Sub ThisDocument_Startup(ByVal sender
As Object, ByVal e
As System
.EventArgs
) Handles
Me.Startup
33 Me.ActionsPane
.Visible
= True
34 Dim p
As PaneControl
= New PaneControl()
35 Me.ActionsPane
.Controls
.Add(p
)
38 Private Sub ThisDocument_Shutdown(ByVal sender
As Object, ByVal e
As System
.EventArgs
) Handles
Me.Shutdown
42 Private Sub ThisDocument_ContentControlAfterAdd(ByVal NewContentControl
As Microsoft
.Office
.Interop
.Word
.ContentControl
, ByVal InUndoRedo
As System
.Boolean) Handles
Me.ContentControlAfterAdd
43 Debug
.Print("ThisDocument_ContentControlAfterAdd :" + NewContentControl
.Title
)
46 Private Sub ThisDocument_ContentControlBeforeContentUpdate(ByVal ContentControl
As Microsoft
.Office
.Interop
.Word
.ContentControl
, ByRef Content
As System
.String) Handles
Me.ContentControlBeforeContentUpdate
47 Debug
.Print("ThisDocument_ContentControlBeforeContentUpdate :" + ContentControl
.Title
)
50 Private Sub ThisDocument_ContentControlBeforeDelete(ByVal OldContentControl
As Microsoft
.Office
.Interop
.Word
.ContentControl
, ByVal InUndoRedo
As System
.Boolean) Handles
Me.ContentControlBeforeDelete
51 Debug
.Print("ThisDocument_ContentControlBeforeDelete :" + OldContentControl
.Title
)
54 Private Sub ThisDocument_ContentControlBeforeStoreUpdate(ByVal ContentControl
As Microsoft
.Office
.Interop
.Word
.ContentControl
, ByRef Content
As System
.String) Handles
Me.ContentControlBeforeStoreUpdate
55 Debug
.Print("ThisDocument_ContentControlBeforeStoreUpdate :" + ContentControl
.Title
)
58 Private Sub ThisDocument_ContentControlOnEnter(ByVal ContentControl
As Microsoft
.Office
.Interop
.Word
.ContentControl
) Handles
Me.ContentControlOnEnter
59 Debug
.Print("ThisDocument_ContentControlOnEnter :" + ContentControl
.Title
)
62 Private Sub ThisDocument_ContentControlOnExit(ByVal ContentControl
As Microsoft
.Office
.Interop
.Word
.ContentControl
, ByRef Cancel
As System
.Boolean) Handles
Me.ContentControlOnExit
63 Debug
.Print("ThisDocument_ContentControlOnExit :" + ContentControl
.Title
)